/*
    1、在恰当的时间使用：super(实参)；
        public CreditAccount(String actno, double balance, double credit) {
        super(actno, balance);  //通过子类的构造方法调用父类的构造方法
        this.credit = credit;
        }
    2、注意：在构造方法执行过程中一连串调用了父类的构造方法，父类的构造方法又继续向下调用它的父类构造方法，但是实际上对象只创建了一个
    3、super(实参)：初始化当前对象的父类型特征，并不是创建新对象，实际上对象只有一个
    4、super关键字代表的就是“当前对象”的那部分父类型特征

    5、类中的实例变量若在构造方法中没有支配的话，一定会给个默认值

    6、super.不能省略：父中有，子中又有，如果想在子中访问“父的特征”，super.不能省

    7、java怎么来区分子类和父类的同名属性的？
        this.name：当前对象的name属性
        super.name：当前对象的父类型特征中的name属性

 */

public class Super02 {
    public static void main(String[] args) {
        CreditAccount ca1 = new CreditAccount();
        System.out.println(ca1.getActno() + "," + ca1.getBalance() + "," + ca1.getCredit());

        CreditAccount ca2 = new CreditAccount("0610",10000.0,0.99);
        System.out.println(ca2.getActno() + "," + ca2.getBalance() + "," + ca2.getCredit());

    }
}

class Account {

    private String actno; //实例变量
    private double balance;


    public Account(){

    }
    public Account(String actno, double balance) {
        this.actno = actno;
        this.balance = balance;
    }

    public String getActno() {
        return actno;
    }
    public void setActno(String actno) {
        this.actno = actno;
    }
    public double getBalance() {
        return balance;
    }
    public void setBalance(double balance) {
        this.balance = balance;
    }
}

class CreditAccount extends Account{
    private double credit;//信誉度

    public CreditAccount() {
    super();
    }

    public CreditAccount(double credit) {
        this.credit = credit;
    }

    public CreditAccount(String actno, double balance, double credit) {
        super(actno, balance);  //通过子类的构造方法调用父类的构造方法
        this.credit = credit;
    }

    public double getCredit() {
        return credit;
    }
    public void setCredit(double credit) {
        this.credit = credit;
    }
}